---
title: Spree Multi Tenant Configuration
sidebarTitle: Configuration
---

Multi-tenant applications include additional configuration options. All configuration should be placed in `config/initializers/spree_multi_tenant.rb` file.

### Root domain

To make multi-tenant, you need a root/wildcard domain, eg. `*.example.com`. Tenant stores are usually accessed via subdomains, eg. `store1.example.com`, `store2.example.com`, etc.

```bash
Spree.root_domain = 'example.com'
```

Still your tenants will be able to add custom domains, eg. `myflowerstore.com` via the Spree admin panel. Tenant subdomains are used only for admin panel access.

### App subdomain

Application subdomains is used to access the application, eg. `app.example.com`. By default for existing tenants it will redirect them to their tenant subdomain, eg. `store1.example.com`. If you want, you can also use this as a tenant signup/store setup page, this is available under `app.example.com/tenants/new`.

You can customize the app subdomain by:

```ruby
SpreeMultiTenant::Config[:app_subdomain] = 'admin'
```

This will change `app.example.com` to `admin.example.com`.

### Emails

Usually email providers, such as SendGrid, require emails to be send from a valid / verified email address, which will be your root domain.

```ruby
SpreeMultiTenant::Config[:mail_from_name] = ENV.fetch('MAIL_FROM_NAME', 'Your SaaS Name')
SpreeMultiTenant::Config[:mail_from_address] = ENV.fetch('MAIL_FROM_ADDRESS', "support@#{Spree.root_domain}")
```

<Info>
`mail_from_name` is only used in admin emails, such as admin staff invitations, exports, etc. For consumer facing emails, this will be your tenant store name, eg. 'My Flower Store` (or whatever they set in the store settings).

Also, customer facing emails will use the tenant email address in `Reply-To` header.
</Info>